import { formatTime } from '@/utils';
import type { DataTableProps } from 'naive-ui';
import { h } from 'vue';

export const systemMessageColumns: DataTableProps['columns'] = [
	{
		title: '标题',
		key: 'title',
		width: 100
	},
	{
		title: '消息内容',
		key: 'content',
		width: 300,
		ellipsis: true
	},
	{
		title: '消息类型',
		key: 'category',
		width: 100,
	},
	{
		title: '推送时间',
		key: 'createTime',
		width: 180,
		render: item => formatTime(item.createTime)
	},
	{
		title: '是否已读',
		key: 'isRead',
		width: 100,
		render: item => h('div', {
			style: {
				color: item.isRead ? 'var(--success-color)' : 'var(--error-color)'
			}
		}, [
			item.isRead ? '已读' : '未读'
		])
	},
	{
		title: '接收人',
		key: 'toUserNos',
		width: 200,
		render: item => item.toUserNos?.join('、')
	},
]
